package org.mullin.stratego.shared;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.Id;

@Entity
public class Match implements Serializable {
	
	private static final long serialVersionUID = 1L;

	@Id public long matchId;
	
	public String serializedState;
	public String redPlayer;
	public String bluePlayer;
	public String winner;
	public boolean inPlay;
	
	public Date startDate = new Date();
	
	List<String> moves = new ArrayList<String>();
	
	@SuppressWarnings("unused")
	private Match() { }
	
	public Match(String redPlayer, String bluePlayer, long matchId) {
		this.matchId = matchId;
		this.redPlayer = redPlayer;
		this.bluePlayer = bluePlayer;
		this.inPlay = true;
		
		//startDate = new Date();
	}
	
	public void addMove(String m) {
		moves.add(m);
	}
	
	public List<String> getMoves() {
		return moves;
	}
	
	public String getRedPlayer() {
		return redPlayer;
	}
	
	public String getBluePlayer() {
		return bluePlayer;
	}
	
	public void setSerializedState(String s) {
		serializedState = s;
	}
	
	public String getSerializedState() {
		return serializedState;
	}
	
	public long getMatchId() {
		return matchId;
	}
	
	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}
	
	public Date getStartDate() {
		return startDate;
	}
}
